package com.ksyun.seckill.controller.online;


import com.ksyun.seckill.dto.OrderbyPhoneDto;
import com.ksyun.seckill.rest.RestResult;
import com.ksyun.seckill.service.OrderService;
import com.ksyun.seckill.util.BizUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 管理端order管理
 */
@RestController
@RequestMapping(value = "/online/order" )
@Slf4j
public class OnlineOrderController {


    @Autowired
    private OrderService orderService;

    /**
     * 我的F码
     * 根据手机号，查询目标手机号的order订单
     * @param phone
     * @return
     */
    @RequestMapping(value = "/listByUserPhone",method = RequestMethod.GET)
    public RestResult listByUserPhone(@RequestParam("phone") String phone){
        BizUtils.validatePhone(phone);
        List<OrderbyPhoneDto> ret_list=orderService.listByUserPhone(phone);
        return RestResult.success().data(ret_list);
    }
}
